import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 布局组件
const index = ()=>import('../pages/index/index')

// 引入组件
const login = ()=>import('../pages/login/login')
const menu = ()=>import('../pages/menu/menu')
const role = ()=>import('../pages/role/role')
const manager = ()=>import('../pages/manager/manager')



export default new Router({
  routes: [
    {
      path:'/login',
      component:login,
    },
    {
      path:'/',
      name:'首页',
      component:index,
      children:[
        {
          path:'menu',
          name:'菜单管理',
          component:menu
        },
        {
          path:'role',
          name:'角色管理',
          component:role
        },
        {
          path:'manager',
          name:'管理员管理',
          component:manager
        }
      ]
    },
    {
      path:'*',//任何不存在的路径
      redirect:'/login',
    }
  ]
})
